package com.rr.sc.model.util;

import java.io.Serializable;
import java.text.SimpleDateFormat;
import java.util.Calendar;
import java.util.Date;

import com.rr.sc.model.Account;
import com.rr.sc.model.Category;
import com.rr.sc.utils.DateUtils;

public class ReportItem implements Serializable {

	private static final long serialVersionUID = 2642557701070810564L;

	private Date date;
	private Account account;
	private Category category;
	private Float balance;
	private Float income;
	private Float outgoings;

	/**
	 * @return the date
	 */
	public Date getDate() {
		return date;
	}

	public String getDateYearMonth() {
		return "" + DateUtils.getYearMonth(date);
	}

	public String getDateText() {
		SimpleDateFormat dateFormat = new SimpleDateFormat("MMMM yyyy");
		Calendar calendar = Calendar.getInstance();
		calendar.setTime(date);
		if (calendar.get(Calendar.DAY_OF_MONTH) == 5) {
			dateFormat = new SimpleDateFormat("yyyy");
		}
		return dateFormat.format(date);
	}

	/**
	 * @param date
	 *            the date to set
	 */
	public void setDate(Date date) {
		this.date = date;
	}

	/**
	 * @return the account
	 */
	public Account getAccount() {
		return account;
	}

	/**
	 * @param account
	 *            the account to set
	 */
	public void setAccount(Account account) {
		this.account = account;
	}

	/**
	 * @return the category
	 */
	public Category getCategory() {
		return category;
	}

	/**
	 * @param category
	 *            the category to set
	 */
	public void setCategory(Category category) {
		this.category = category;
	}

	/**
	 * @return the balance
	 */
	public Float getBalance() {
		return balance;
	}

	/**
	 * @param balance
	 *            the balance to set
	 */
	public void setBalance(Float balance) {
		this.balance = balance;
	}

	/**
	 * @return the income
	 */
	public Float getIncome() {
		return income;
	}

	/**
	 * @param income
	 *            the income to set
	 */
	public void setIncome(Float income) {
		this.income = income;
	}

	/**
	 * @return the outgoings
	 */
	public Float getOutgoings() {
		return outgoings;
	}

	/**
	 * @param outgoings
	 *            the outgoings to set
	 */
	public void setOutgoings(Float outgoings) {
		this.outgoings = outgoings;
	}

}
